<template>
    <LoginHeader>欢迎登录</LoginHeader>
    <div class="login-container">
        <div class="wrapper">
            <nav>
                <a @click="activeName='account'" :class="{active:activeName==='account'}" href="javascript:;">账户登录</a>
                <a @click="activeName='qrcode'" :class="{active:activeName==='qrcode'}" href="javascript:;">扫码登录</a>
            </nav>

            <!-- 表单 -->
            <LoginForm v-if="activeName==='account'"></LoginForm>

            <!-- 二维码 -->
            <div v-if="activeName==='qrcode'" class="qrcode-box">
                <img src="@/assets/images/qrcode.png" alt="">
                <p>打开 <a href="javascript:;">三叉戟生鲜App</a> 扫码登录</p>
            </div>
        </div>
    </div>
</template>


<script setup>
import LoginHeader from './components/LoginHeader.vue'
import LoginForm from './components/LoginForm.vue'


import { ref } from 'vue'

const activeName = ref('account')

</script>
<style scoped lang="scss">
.login-container {
  background: url(../../assets/images/login-bg.png) no-repeat center -80px / cover;
  height: 390px;
  position: relative;
  .wrapper {
    width: 380px;
    background: #fff;
    min-height: 360px;
    position: absolute;
    left: 50%;
    top: 14px;
    transform: translate3d(100px,0,0);
    box-shadow: 0 0 10px rgba(0,0,0,.15);
    nav {
      height: 55px;
      border-bottom: 1px solid #f5f5f5;
      display: flex;
      padding: 0 40px;
      text-align: right;
      align-items: center;  
      a {
        flex: 1;
        line-height: 1;
        display: inline-block;
        font-size: 18px;
        position: relative;
        &:first-child {
          border-right: 1px solid #f5f5f5;
          text-align: left;
        }
        &.active{
          color: $main-color;
          font-weight: bold;
        }
      }
    }
    .qrcode-box {
      text-align: center;
      padding-top: 40px;
      img {
        width: 50%;
      }
      p {
        margin-top: 20px;
        a {
          color: $main-color;
          font-size: 16px;
        }
      }
    }
  }
}
</style>